#!/usr/bin/python

# -*- coding: utf-8 -*-

import httplib2

from urllib.parse import urlencode #python3

#from urllib import urlencode #python2



params = urlencode({'ip':'47.70.101.139','datatype':'jsonp','callback':'find'})

url = 'http://api.ip138.com/query/?'+params

headers = {"token":"a4e47de6d3b44329a52195d5473aeea2"}#token为示例

http = httplib2.Http()

response, content = http.request(url,'GET',headers=headers)

print(content.decode("utf-8"))

